local skel = fk.CreateSkill {
  name = "emo__qingxi",
}

Fk:loadTranslationTable{
  ["emo__qingxi"] = "倾袭",
  [":emo__qingxi"] = "出牌阶段结束时，你可以对一名手牌数等于你的角色造成1点伤害，然后其执行一个出牌阶段。",

  ["#emo__qingxi-choose"] = "倾袭：你可以对1名手牌数等于你的角色造成1点伤害，令其执行1个出牌阶段。",

  ["$emo__qingxi1"] = "策马疾如电，溃敌一瞬间。",
  ["$emo__qingxi2"] = "虎豹骑岂能徒有虚名？杀！",
}

skel:addEffect(fk.EventPhaseEnd, {
  anim_type = "offensive",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and data.phase == Player.Play
  end,
  on_cost = function (self, event, target, player, data)
    local targets = table.filter(player.room.alive_players, function (p) return p:getHandcardNum() == player:getHandcardNum() end)
    local tos = player.room:askToChoosePlayers(player, {
      min_num = 1, max_num = 1, targets = targets, skill_name = skel.name,
      prompt = "#emo__qingxi-choose",
    })
    if #tos > 0 then
      event:setCostData(self, {tos = tos})
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local to = event:getCostData(self).tos[1]
    if to and to:isAlive() then
      room:damage { from = player, to = to, damage = 1, skillName = skel.name }
      if not to.dead then
        to:gainAnExtraPhase(Player.Play, skel.name)
      end
    end
  end,
})

return skel
